home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-18 | 2.2 KB | 93 lines | [TEXT/MPS ] |
- #include <iostream.h>
- #include "cscsi.h"
-
- /*
- // 0 Direct-access device (disk)
- // 1 Sequential-access device (tape)
- // 2 Printer
- // 3 Processor
- // 4 Write-once device (some optical disks)
- // 5 CD-ROM
- // 6 Scanner
- // 7 Optical memory (some optical disks)
- // 8 Medium changer
- // 9 Communications
- // 10-11 Graphic Arts Pre-Press devices
- */
-
- Byte buf[256];
-
- void main( void )
- {
- long i;
- short id;
- CSCSIOp * inq = new CSCSIOp;
- CSCSIOp * cmd = new CSCSIOp;
- CSCSIOp * rew = new CSCSIOp;
- CSCSIOp * load = new CSCSIOp;
- CSCSIOp * sense = new CSCSIOp;
-
- cout << "Test of identifying SCSI Devices" << endl;
-
- inq->set6( 18, 0, 0, 0, 255, 0 );
- inq->setBuf( buf );
- inq->setLen( 255 );
- inq->setDir( dataIn );
-
- //
- // Find the tape drive
- //
- for ( id = 0; id < 7; id++ )
- {
- //
- //First, we issue an INQUIRY to see what kind of device it is.
- //
- inq->keep( USE_CDB | USE_DIR | USE_BUF | USE_LEN );
- inq->setID( id );
- inq->execute();
- if ( inq->getErr() )
- continue;
- //
- // Byte 0 of INQUIRY data contains the device type.
- //
- switch ( (buf[0] & 0x1f) )
- {
- case 0:
- cout << "Device at SCSI ID " << id << " is a Direct-access device (disk) " << endl;
- break;
- case 1:
- cout << "Device at SCSI ID " << id << " is a Sequential-access device (tape) " << endl;
- break;
- case 2:
- cout << "Device at SCSI ID " << id << " is a Printer " << endl;
- break;
- case 3:
- cout << "Device at SCSI ID " << id << " is a Processor " << endl;
- break;
- case 4:
- cout << "Device at SCSI ID " << id << " is a Write-once device (some optical disks) " << endl;
- break;
- case 5:
- cout << "Device at SCSI ID " << id << " is a CD-ROM " << endl;
- break;
- case 6:
- cout << "Device at SCSI ID " << id << " is a Scanner " << endl;
- break;
- case 7:
- cout << "Device at SCSI ID " << id << " is a Optical memory (some optical disks) " << endl;
- break;
- case 8:
- cout << "Device at SCSI ID " << id << " is a Medium changer " << endl;
- break;
- case 9:
- cout << "Device at SCSI ID " << id << " is a Communications " << endl;
- break;
- case 10:
- case 11:
- cout << "Device at SCSI ID " << id << " is a Graphic Arts Pre-Press devices " << endl;
- break;
-
- }
- }
- }
-